<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	<title></title>
	<link href="{$Think.const.ADMIN_CSS_PATH}general.css" rel="stylesheet" type="text/css" />
	<link href="{$Think.const.ADMIN_CSS_PATH}main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>
	<span class="action-span"><a href="__MODULE__/Goods/goods_add">添加新商品</a></span>
	<span class="action-span1"><a href="index.php?act=main">SHOP 管理中心</a> </span><span id="search_id" class="action-span1"> - 商品列表 </span>
	<div style="clear:both"></div>
</h1>

<div class="form-div">
  <form action="" name="searchForm">
    <img src="{$Think.const.ADMIN_IMG_PATH}icon_search.gif" width="26" height="22" border="0" alt="SEARCH">
        <!-- 分类 -->
    <select name="cat_id" onchange="selectCat(this.value)";>
		<option value="0">所有分类</option>
		<?php foreach($cats as $cat):?>
		<option value="<?php echo $cat['cat_id']?>" <?php echo $_GET['cat_id'] == $cat['cat_id']?'selected=selected':'';?>><?php echo $cat['cat_name']?></option>
		<?php endforeach;?>
	</select>
    <!-- 品牌 -->
    <select name="brand_id"  onchange="selectBrand(this.value)";>
		<option value="0">所有品牌</option>
		<?php foreach($brands as $brand):?>
		<option value="<?php echo $brand['brand_id']?>" <?php echo $_GET['brand_id'] == $brand['brand_id']?'selected=selected':'';?>><?php echo $brand['brand_name']?></option>
		<?php endforeach;?>
	
	</select>
    <!-- 推荐 -->
    <select name="intro_type"  onchange="select(this.value)";>
		<option value="0">全部</option>
		<option value="is_best" <?php echo $_GET['state'] == 'is_best'?'selected=selected':'';?>>精品</option>
		<option value="is_new" <?php echo $_GET['state'] == 'is_new'?'selected=selected':'';?>>新品</option>
		<option value="is_hot" <?php echo $_GET['state'] == 'is_hot'?'selected=selected':'';?>>热销</option>
	</select>
         
     <!-- 供货商 -->
 <!--     <select name="suppliers_id">
 		<option value="0">全部</option>
 		<option value="1">北京供货商</option>
 		<option value="2">上海供货商</option>
 	</select> -->
    <!-- 上架 -->
     <select name="is_on_sale" onchange="isOn(this.value)";>
		<option value="">全部</option>
		<option value="1" <?php echo $_GET['status'] == 1?'selected=selected':'';?>>上架</option>
		<option value="0" <?php echo $_GET['status'] == 0?'selected=selected':'';?>>下架</option>
	</select>
	<!-- 关键字 -->
		关键字 <input type="text" name="keyword" size="15">
		<input type="button" value=" 搜索 " class="button" onclick="Search()";>
  </form>
</div>

<form method="post" action="" name="listForm" onsubmit="return confirmSubmit(this)">
  <!-- start goods list -->
	<div class="list-div" id="listDiv">
		<table cellpadding="3" cellspacing="1">
			<tbody>
				<tr>
					<th><input type="checkbox">编号</th>
					<th>商品名称</th>
					<th>货号</th>
					<th>价格</th>
					<th>上架</th>
					<th>精品</th>
					<th>新品</th>
					<th>热销</th>
		
					<th>库存</th>
					<th>操作</th>
				</tr>
				<tr></tr>
				<?php foreach ($datas as $k=>$v):?>
				<tr>
					<td><input type="checkbox" name="checkboxes[]" value="32"><?php echo $v['goods_id'];?></td>
					<td class="first-cell"><span><?php echo $v['goods_name'];?>诺基亚N85</span></td>
					<td><span><?php echo $v['goods_sn'];?></span></td>
					<td align="right"><span><?php echo $v['shop_price'];?></span></td>
					<td align="center"><?php echo $v['is_on_sale'] == 1?'√':'×';?></td>
					<td align="center"><?php echo $v['is_best'] == 1?'√':'×';?></td>
					<td align="center"><?php echo $v['is_new'] == 1?'√':'×';?></td>
					<td align="center"><?php echo $v['is_hot'] == 1?'√':'×';?></td>
					<td align="right"><span onclick=""><?php echo $v['goods_number'];?></span></td>
					<td align="center">
						<a href="../goods.php?id=32" target="_blank" title="查看"><img src="{$Think.const.ADMIN_IMG_PATH}icon_view.gif" width="16" height="16" border="0"></a>
						<a href="goods.php?act=edit&amp;goods_id=32" title="编辑"><img src="{$Think.const.ADMIN_IMG_PATH}icon_edit.gif" width="16" height="16" border="0"></a>
						<a href="goods.php?act=copy&amp;goods_id=32" title="复制"><img src="{$Think.const.ADMIN_IMG_PATH}icon_copy.gif" width="16" height="16" border="0"></a>
						<a href="__CONTROLLER__/hsz/goods_id/<?php echo $v['goods_id'];?>" name='hsz' title="回收站"><img src="{$Think.const.ADMIN_IMG_PATH}icon_trash.gif" width="16" height="16" border="0"></a>
						<a href="goods.php?act=product_list&amp;goods_id=32" title="货品列表"><img src="{$Think.const.ADMIN_IMG_PATH}icon_docs.gif" width="16" height="16" border="0"></a>          
					</td>
				</tr>
			<?php endforeach;?>
	
  <!-- end 这段代码没有格式化，只是暂时显示数据用 开发的时候将会删除-->
  </tbody>
 </table>
<!-- end goods list -->

	<!-- 分页 -->
	<table id="page-table" cellspacing="0">
		<tbody>
			<tr>
				<td align="right" nowrap="true" style="background-color: rgb(255, 255, 255);">
					<!-- $Id: page.htm 14216 2008-03-10 02:27:21Z testyang $ -->
<!-- 					<div id="turn-page">
	总计  <span id="totalRecords">22</span>个记录分为 <span id="totalPages">2</span>页当前第 <span id="pageCurrent">1</span>
	页，每页 <input type="text" size="3" id="pageSize" value="15" onkeypress="return listTable.changePageSize(event)">
	<span id="page-link">
		<a href="javascript:listTable.gotoPageFirst()">第一页</a>
		<a href="javascript:listTable.gotoPagePrev()">上一页</a>
		<a href="javascript:listTable.gotoPageNext()">下一页</a>
		<a href="javascript:listTable.gotoPageLast()">最末页</a>
		<select id="gotoPage" onchange="listTable.gotoPage(this.value)">
		<option value="1">1</option><option value="2">2</option>          </select>
	</span>
	</div> <-->		
				{$page}
				</td>
			</tr>
		</tbody>
	</table>
</div>

<div>
<!-- 	<input type="hidden" name="act" value="batch">
	<select name="type" id="selAction" onchange="changeAction()">
		<option value="">请选择...</option>
		<option value="trash">回收站</option>
		<option value="on_sale">上架</option>
		<option value="not_on_sale">下架</option>
		<option value="best">精品</option>
		<option value="not_best">取消精品</option>
		<option value="new">新品</option>
		<option value="not_new">取消新品</option>
		<option value="hot">热销</option>
		<option value="not_hot">取消热销</option>
		<option value="move_to">转移到分类</option>
		<option value="suppliers_move_to">转移到供货商</option>
	</select> -->

<!--     <input type="hidden" name="extension_code" value="">
<input type="submit" value=" 确定 " id="btnSubmit" name="btnSubmit" class="button" disabled="true">
 --></div>
</form>

<div id="footer">
	版权所有 &copy;
</div>

</body>
</html>
<script type="text/javascript">

		var hsz = document.getElementsByName('hsz');

		for (var i = 0; i < hsz.length; i++) {
			
				hsz[i].onclick = function()
				{
					if(confirm('你确定要删除么?'))
					{
						var url = this.href;
						this.href = '';

						 var xhr = new XMLHttpRequest();

						 xhr.onreadystatechange = function()
						 {
						 		if(this.readyState == 4)
						 		{
						 			alert(this.responseText);
						 		}
						 }

						 xhr.open('get',url,false);
						 xhr.send(null);
					}
					else
					{
						return false;
					}
				}
		}


	function selectCat(cat_id)
	{	
		//console.log(cat_id);
		var url = 'http://22.com/Admin/Goods/goods_list/cat_id/'+cat_id;

		window.location.href = url;
	}

		function selectBrand(brand_id)
	{	
		//console.log(brand_id);
		var url = 'http://22.com/Admin/Goods/goods_list/brand_id/'+brand_id;

		window.location.href = url;
	}

		function select(state)
	{	
		
		var url = 'http://22.com/Admin/Goods/goods_list/state/'+state;

		window.location.href = url;
	}

		function isOn(status)
	{	
		console.log(status);
		var url = 'http://22.com/Admin/Goods/goods_list/status/'+status;

		window.location.href = url;
	}

	function Search()
	{
		var val = document.getElementsByName('keyword')[0].value;

		var url = 'http://22.com/Admin/Goods/goods_list/select/'+val;

		window.location.href = url;
		}
</script>